#include "mymenu.h"


MyMenu::MyMenu(QWidget *parent)
    : QMenu{parent}
{
    action.setText("复制");
    action.setParent(this);
    this->addAction(&action);
}

void MyMenu::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        // 在这里调用您的MyAction对象的相关方法
        emit copyClicked();
        this->close();
    }
    QWidget::mousePressEvent(event);
}

